import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '@/views/Login'
import Home from '@/views/Home'
import Build from '@/components/Build'
import User from '@/components/User'
import Welcome from '@/components/Welcome'
import Dormitory from '@/components/Dormitory'
import Visit from '@/components/Visit'
import Clean from '@/components/Clean'
import UserIndex from '@/views/UserIndex'
import Student from '@/components/Student'
import BuildUser from '@/components/BuildUser'
import DormitoryStudent from '@/components/DormitoryStudent'

Vue.use(VueRouter)

const routes = [
  { path: '/', name: 'login', component: Login },
  { path: '/UserIndex', name: 'UserIndex', component: UserIndex },
  {
    path: '/home',
    name: 'Home',
    component: Home,
    redirect: '/welcome',
    children: [
      { path: '/welcome', component: Welcome },
      { path: '/build', component: Build },
      { path: '/buildUser', component: BuildUser },
      { path: '/user', component: User },
      { path: '/dormitory', component: Dormitory },
      { path: '/dormitoryStudent', component: DormitoryStudent },
      { path: '/clean', component: Clean },
      { path: '/visit', component: Visit },
      { path: '/student', component: Student }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
